#ifndef XMLHANDLER_H
#define XMLHANDLER_H

#include <QXmlDefaultHandler>
#include "xmlinterface.h"
#include "propdata.h"

class XMLHandler : public QXmlDefaultHandler
{
public:
    explicit XMLHandler(XMLInterface *x);

    bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts);
    bool endElement(const QString &namespaceURI, const QString &localName, const QString &qName);
    bool characters(const QString &ch);
    bool fatalError(const QXmlParseException &exception);

private:
    enum POINT_TYPE { PROP_POINT, MINIMAP_TOP_POINT, MINIMAP_LOW_POINT };

    XMLInterface *xml;

    bool inPropName;
    bool inPoint;
    bool inLat;
    bool inLon;
    bool inAlt;
    bool inRad;
    bool inAudMain;
    bool inAud;
    bool inVid;
    bool inPic;
    QString propName;
    POINT_TYPE pointType;
    double latitude;
    double longitude;
    double altitude;
    double radius;
    QString audMain;
    QString audMainScript;
    QString audMainScriptFile;
    std::vector<Coordinate> propCoords;
    std::vector<QString> aud, vid, pic;
    PropData *tmpProp;
};

#endif // XMLHANDLER_H
